package design.pattern.factory.simple$factory;

/**
 * 简单咖啡工厂类
 *
 * @author AtoVio, Winter Yuan
 */
public class SimpleCoffeeFactory {

    public Coffee createCoffee(CoffeeType type) {
        Coffee coffee;
        if (type == CoffeeType.AMERICAN) {
            coffee = new AmericanCoffee();
        } else if (type == CoffeeType.LATTE) {
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("对不起，没有对应类型咖啡");
        }
        return coffee;
    }
}
